/*
    www.cguage.com
    3.2 按字典顺序列出子集 比如123 13 2 23 3
*/

#include <iostream>
#include <sstream>
#include <cassert>
#include <vector>
using namespace std;

#ifndef TEST
#define IN(iss) {                       \
        std::string str;                \
        std::getline(std::cin, str);    \
        iss.str(str);                   \
    }
#define OUT(s) std::cout << s
#endif

#define READ_N(iss, n) {    \
    iss >> n;               \
    iss.ignore(1, ',');     \
}

int main() {
    istringstream iss;
    ostringstream oss;
    IN(iss);
    int n = -1;
    iss >> n;

    std::vector<int> set;
    set.resize(n, -1);
    set[0] = 1;
    int pos = 0;

    oss << "_ ";

    for (;;) {

        for (int i = 0; i <= pos; ++i) {
            oss << set[i];
        }
        oss << " ";

        if (set[pos] < n) {
            // 12 -> 123 -> 1234 -> ...
            set[pos + 1]  = set[pos] + 1;
            ++pos;
        } else if (pos != 0) {
            // 回退一位做++操作 13
            ++set[--pos];
        } else {
            break;
        }

    }

    string str = oss.str();
    str.erase(str.end() - 1);
    OUT(str);
    return 0;
}

#ifdef TEST
struct TestCase CASES[] = {
    /*0*/{"4", "_ 1 12 123 1234 124 13 134 14 2 23 234 24 3 34 4"},
    /*1*/{"1", "_ 1"},
    /*2*/{"2", "_ 1 12 2"},
};
#endif